<template>
  <div>
    <!-- 外层容器 -->
    <el-container>
      <!-- 上半区域：顶栏 -->
      <el-header class="layout-header">
        <h1>酒店后台管理平台</h1>
      </el-header>
      <!-- 下半区域 -->
      <el-container class="layout-body">
        <!-- 下半区域的左侧边栏 -->
        <el-aside class="layout-aside">
          <el-menu
              router
              :default-active="activeMenuItemPath"
              class="el-menu-vertical-demo"
              background-color="#222"
              text-color="#fff"
              active-text-color="#fff">
            <!-- 首页 -->
            <el-menu-item index='/admin/adminPage/AdminIndex'>
              <i class="el-icon-s-home"></i>
              <span>首页</span>
            </el-menu-item>
            <!-- 临时页面 -->
            <el-submenu index="systemIndex">
              <template slot="title">
                <i class="el-icon-house"></i>
                <span>前台首页管理模块</span>
              </template>
              <el-menu-item index='/admin/adminPage/SystemIndexAddNew'>
                <i class="el-icon-circle-plus"></i>
                <span>添加轮播图</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/SystemIndex'>
                <i class="el-icon-s-operation"></i>
                <span>首页轮播图管理</span>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="user">
              <template slot="title">
                <i class="el-icon-user-solid"></i>
                <span>用户管理模块</span>
              </template>
              <el-menu-item index='/admin/adminPage/UserAddNew'>
                <i class="el-icon-circle-plus"></i>
                <span>添加用户</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/UserListView'>
                <i class="el-icon-s-operation"></i>
                <span>用户管理</span>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="hotel">
              <template slot="title">
                <i class="el-icon-office-building"></i>
                <span>酒店管理模块</span>
              </template>
              <el-menu-item index='/admin/adminPage/HotelAddNew'>
                <i class="el-icon-circle-plus"></i>
                <span>添加酒店</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/HotelListView'>
                <i class="el-icon-s-operation"></i>
                <span>酒店管理</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/HotelScore'>
                <i class="el-icon-s-operation"></i>
                <span>酒店评分管理</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/HotelUserCommentListView'>
                <i class="el-icon-s-operation"></i>
                <span>酒店用户评论管理</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/HotelRoomInfoAddNew'>
                <i class="el-icon-circle-plus"></i>
                <span>添加酒店房间信息</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/HotelRoomInfoListView'>
                <i class="el-icon-s-operation"></i>
                <span>酒店房间信息管理</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/HotelComplainingListView'>
                <i class="el-icon-s-operation"></i>
                <span>酒店投诉管理</span>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="theme">
              <template slot="title">
                <i class="el-icon-menu"></i>
                <span>主题住宿管理模块</span>
              </template>
              <el-menu-item index='/admin/adminPage/SceneryAddNew'>
                <i class="el-icon-circle-plus"></i>
                <span>添加主题住宿</span>
              </el-menu-item>
              <el-menu-item index='/admin/adminPage/SceneryListView'>
                <i class="el-icon-s-operation"></i>
                <span>主题住宿管理</span>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="hotelCommit">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>景点攻略管理模块</span>
              </template>
              <el-menu-item index="/admin/adminPage/SecondaryBannerAddNew">
                <i class="el-icon-circle-plus"></i>
                <span>添加轮播图</span>
              </el-menu-item>
              <el-menu-item index="/admin/adminPage/SecondaryBannerListView">
                <i class="el-icon-s-operation"></i>
                <span>轮播图列表</span>
              </el-menu-item>
              <el-menu-item index="/admin/adminPage/SecondaryConsultAddNew">
                <i class="el-icon-circle-plus"></i>
                <span>添加景点攻略</span>
              </el-menu-item>
              <el-menu-item index="/admin/adminPage/SecondaryConsultListView">
                <i class="el-icon-s-operation"></i>
                <span>景点攻略列表</span>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="orders">
              <template slot="title">
                <i class="el-icon-s-order"></i>
                <span>订单管理模块</span>
              </template>
              <el-menu-item index='/admin/adminPage/OrdersListView'>
                <i class="el-icon-s-operation"></i>
                <span>订单管理</span>
              </el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>
        <!-- 下半区域的右侧主体 -->
        <el-main class="layout-main">
          <!-- 由其它视图来显示 -->
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'

export default {
  data(){
    return{
      activeMenuItemPath:''
    }
  },
  watch:{
    /*监听路由变化当发生跳转时，可以让导航栏激活当前路径的导航*/
    '$route'(to,from){
      this.activeMenuItemPath=to.path
    }
  },
  methods:{

  },
  mounted() {
    let path = this.$router.currentRoute.path;
    this.activeMenuItemPath = path;
  }
}
</script>
<style>
.layout-header {
  background: #1684b0;
}

.layout-header h1 {
  color: #fff;
  line-height: 60px;
}

.layout-body {
  position: absolute;
  top: 60px;
  bottom: 0;
  left: 0;
  right: 0;
}

.layout-aside {
  background: #222;
}

.layout-aside i {
  color: #fff !important;
}

.layout-main {
  background: #fff;
}

.el-menu-item.is-active {
  background: #2d3c4d !important;
}
</style>
